package cn.edu.stu.syllabus.base;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by daidaijie on 2017/4/16.
 */

public abstract class BaseQuickClickAdapter<T, K extends BaseViewHolder>
        extends BaseQuickAdapter<T, K> {

    protected OnItemClickListener<T> mOnItemClickListener;

    protected OnItemLongClickListener<T> mOnItemLongClickListener;

    protected OnItemViewClickListener<T> mOnItemViewClickListener;

    protected OnItemViewLongClickListener<T> mItemViewLongClickListener;

    protected boolean mClickable = true;

    public OnItemClickListener<T> getOnItemClickListener() {
        return mOnItemClickListener;
    }

    public void setOnItemClickListener(OnItemClickListener<T> onItemClickListener) {
        mOnItemClickListener = onItemClickListener;
    }

    public OnItemLongClickListener<T> getOnItemLongClickListener() {
        return mOnItemLongClickListener;
    }

    public void setOnItemLongClickListener(OnItemLongClickListener<T> onItemLongClickListener) {
        mOnItemLongClickListener = onItemLongClickListener;
    }

    public OnItemViewClickListener<T> getOnItemViewClickListener() {
        return mOnItemViewClickListener;
    }

    public void setOnItemViewClickListener(OnItemViewClickListener<T> onItemViewClickListener) {
        mOnItemViewClickListener = onItemViewClickListener;
    }

    public OnItemViewLongClickListener<T> getItemViewLongClickListener() {
        return mItemViewLongClickListener;
    }

    public void setItemViewLongClickListener(OnItemViewLongClickListener<T> itemViewLongClickListener) {
        mItemViewLongClickListener = itemViewLongClickListener;
    }

    public BaseQuickClickAdapter(List data) {
        super(data);
    }

    public BaseQuickClickAdapter(int layoutResId) {
        super(layoutResId);
    }

    public BaseQuickClickAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    public interface OnItemClickListener<T> {
        void onItemClick(T t, int position);
    }

    public interface OnItemViewClickListener<T> {
        void onItemViewClick(View view, T t, int position);
    }

    public interface OnItemViewLongClickListener<T> {
        boolean onItemViewLongClick(View view, T t, int position);
    }

    public interface OnItemLongClickListener<T> {
        boolean onItemLongClick(T t, int position);
    }

    public boolean isClickable() {
        return mClickable;
    }

    public void setClickable(boolean clickable) {
        mClickable = clickable;
    }
}
